package com.woniuxy.redis.controller;/*
@author houguai
@create 2021-01-13 11:20
*/

import com.woniuxy.redis.entity.Teacher;
import com.woniuxy.redis.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @RequestMapping("/all")
    public List<Teacher> findTeacher(){
        System.out.println("执行controller方法");
        System.out.println("张三写的");
        System.out.println("这是在张三上变成的代码");
        return   teacherService.all();
    }

    @RequestMapping("/find")
    public Teacher findTeacherById(int id){
        System.out.println("执行controller方法");
        return teacherService.findById(id);
    }

    @RequestMapping("/del")
    public Boolean delById(int id){

        return teacherService.delById(id);
    }

}
